// Max Sum
#include <iostream>
#include <vector>
using namespace std;

vector<long long> sequence;
vector<long long> dp;

int main()
{
    ios::sync_with_stdio(false);
    long long T, N, tmp;
    long long i, j, count = 0;
    long long start, end, max, first, last;
    cin >> T;
    while (T--)
    {
        count++;
        sequence.clear();
        dp.clear();
        cin >> N;
        for (long long i = 0; i < N; i++)
        {
            cin >> tmp;
            sequence.push_back(tmp);
            dp.push_back(0);
        }
        dp[0] = sequence[0];
        start = end = first = last = 0;
        max = -100000;
        for (i = 1; i < N; i++)
        {
            if (dp[i - 1] + sequence[i] >= sequence[i])
            {
                dp[i] = dp[i - 1] + sequence[i];
                end = i;
            }
            else
            {
                dp[i] = sequence[i];
                start = end = i;
            }
            if (max < dp[i])
            {
                max = dp[i];
                first = start;
                last = end;
            }
        }
        cout << "Case " << count << endl
             << max << " " << first + 1 << " " << last + 1 << endl;
        cout << endl;
    }
    return 0;
}